package com.ishopping.api.manage.service;

import com.ishopping.api.manage.entity.RolePermission;
import com.ishopping.common.core.base.service.IBaseService;

import java.util.List;

public interface IRolePermissionService extends IBaseService<RolePermission> {
    /**
     * 通过roleId获取用户权限
     * @param roleId
     * @return List<Long>
     */
    List<RolePermission> findRolePermissionsByRoleId(Long roleId);

    /**
     * 更新用户关联的权限
     * @param roleId
     * @param newPermissionList
     * @return int
     */
    int save(Long roleId, List<Long> newPermissionList);

    /**
     * 通过roleId删除其关联的权限
     * @param roleId
     * @return int
     */
    int deleteByRoleId(Long roleId);

    /**
     * 批量插入用户关联的权限
     * @param newPermissionList
     * @param roleId
     * @return int
     */
    int batchInsert(Long roleId, List<Long> newPermissionList);
}